package com.wubotao.algorithm;

import java.util.Arrays;

public class BubbleSort {
	public static void sort(int[] array) {
		int temp = 0;
		for (int i = array.length - 1; i > 0; i--) {
			for (int j = 0; j < i; j++) {
				if (array[j + 1] < array[j]) {
					temp = array[j];
					array[j] = array[j + 1];
					array[j + 1] = temp;
				}
			}
		}
	}

	public static void main(String[] args) {
		int [] array = {5, 69, 12, 3, 56, 789, 2, 5648, 23};
		sort(array);
		System.out.println(Arrays.toString(array));
	}
}


